<template>
	<view class="cust_detail">
		<view class="cust_item_con" v-for="(item,index) in cost_list" :key="index"
			@click="toCostDetail(item.id)">
			<view class="con_info">
				<view style="font-weight: 600;">{{item.consume_type}}</view>
				<view class="c_time">{{item.consume_time}}</view>
			</view>
			<view class="con_center">
				<view>消费金额：</view>
				<view class="con_money">&yen; {{item.money}}</view>
			</view>
			<view style="color: #999;font-size: 32rpx;padding-left: 63rpx;">备注:{{item.remark}}</view>
			<view class="con_foot">
				<view class="c_f_top">
					附件：
				</view>
				<scroll-view scroll-x style="width: 100%; white-space: nowrap;padding-left: 63rpx;">
					<view 
						class="box" v-for="(ind,index) in item.file_text" :key="index"
						style="display: inline-block;margin-right:50rpx;  width: 150rpx; height: 150rpx; background: #ededed;">
						<image 
							:src=" ind? ind: BASE_IMG_URL+'headImg.png'" 
							class="headimg"
							style="width: 150rpx;height: 150rpx;"
							mode="scaleToFill"></image>
					</view>
					<image style="width: 44rpx;height: 44rpx;margin: 53rpx 0;"
							v-if=" item.file_text.length >= 3"
						:src="BASE_IMG_URL+'more_look.png'" mode="scaleToFill"></image>
				</scroll-view>
			</view>
			<view class="status" v-if="item.check_status == 0"><span>待审核</span></view>
			<view class="status" v-if="item.check_status == 1"><span>审核中</span></view>
			<view class="status" v-if="item.check_status == 2"><span>审核通过</span></view>
			<view class="status" v-if="item.check_status == 3"><span>审核未通过</span></view>
			<view class="status" v-if="item.check_status == 4"><span>撤销</span></view>
		</view>
		
		<view style="height: 200rpx;"></view>
		<u-empty v-if="cost_list.length == 0" text="暂无更多"></u-empty>

		<view class="icon_creat" v-if="type == 1" @click="addCost">
			<image :src="BASE_IMG_URL+'1.png'" mode="scaleToFill"></image>
		</view>
	</view>
</template>

<script>
	import {
		netCostList
	} from '@/api/kehu.js'
	import {
		netGetSignList
	} from '@/api/index.js'
	import {
		BASE_IMG_URL
	} from '@/util/api.js'

	export default {
		data() {
			return {
				BASE_IMG_URL: BASE_IMG_URL,
				cost_list: [], //费用列表
				id: '',
				type:1,   //1普通客户  2公海客户
			}
		},
		onLoad(options) {
			this.id = options.id
			this.type = options.type
		},
		onShow() {
			console.log(this.id, '更多信息')
			//费用列表
			this.getCostlist()
		},
		methods: {
			//费用 列表
			getCostlist() {
				netCostList({
					customer_id: this.id
				}).then(res => {
					this.cost_list = res.data.data
				})
				console.log(this.cost_list.consume_time)
			},

			//新建费用
			addCost() {
				uni.navigateTo({
					url: '/pages/index/groupCompany/cost/addCost?kehuid=' + this.id
				})
			},
			//费用 详情
			toCostDetail(id) {
				uni.navigateTo({
					url: '/pages/index/groupCompany/cost/costDetail?id=' + id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.imgbox{
		align-items: center;
		margin-top:15rpx;
		.box{
			width: 150rpx;
			height: 150rpx;
			margin-left: 30rpx;
			background: #ededed;
			float: left;
		}
		image{
			margin: auto 0;
		}
	}
	.cust_detail{
		.cust_item_con{
			background: #fff;
			margin-top: 20rpx;
			.con_info{
				display: flex;
				justify-content: space-between;
				font-size: 34rpx;
				color: #333;
				padding: 38rpx 30rpx 0rpx 63rpx;
				.c_time{
					margin: 10rpx;
					font-size: 28rpx;
					color: #999;
				}
			}
			.con_center{
				display: flex;
				justify-content: space-between;
				font-size: 32rpx;
				height: 80rpx;
				line-height: 80rpx;
				color:#999999;
				padding: 0 30rpx 0rpx 63rpx;
				.con_money{
					color: #03AA96;
					font-size: 40rpx;
					font-weight: 600;
				}
			}
			.con_foot{
				.c_f_top{
					font-size: 32rpx;
					color: #999;
					padding: 20rpx 0 25rpx 63rpx;
				}
				.c_f_foot{
					display: flex;
					justify-content: space-around;
					.box{
						width: 150rpx;
						height: 150rpx;
						background: #ededed;
					}
					image{
						margin: auto 0;
					}
				}
			}
			.status{
				padding: 35rpx 63rpx;
				span{
					font-size: 26rpx;
					color: #03AA96;
					padding: 5rpx 12rpx;
					background: rgba(3, 170, 150, .1);
				}
			}
		}
	}
	#btn {
		font-size: 26rpx;
		color: #fff;
		text-align: center;
		line-height: 88rpx;
		width: 500rpx;
		height: 88rpx;
		background: #03AA96;
		border-radius: 29rpx;
		margin: 30rpx auto;
	}
</style>
